#!/bin/bash

count_files() {
    directory="$1"
    pattern="$2"
    files=$(ls -l $directory/$pattern 2>/dev/null | wc -l)
    echo "$files"
}

# Define the common prefix
prefix=$1

directories=(
"Patterns/**"
"Two-player-Game/**/System-first"
"Two-player-Game/Nim/**/System-first"
"Random/Lydia/**"
"Random/Syft/syft_1"
"Random/Syft/syft_2"
"Random/Syft/syft_3"
"Random/Syft/syft_4"
"Random/Syft/syft_5"
"Ascending/tree_size_1"
"Ascending/tree_size_2"
"Ascending/tree_size_3"
"Ascending/tree_size_4"
"Ascending/tree_size_5"
"Ascending/tree_size_6"
"Ascending/tree_size_7"
"Ascending/tree_size_8"
"Ascending/tree_size_9"
)

printf "res VS ltlf (file numbers) in %s:\n\n" "$prefix"

for ((i=0; i<${#directories[@]}; i++)); do
    directory="${prefix}/${directories[$i]}"
    pattern="${patterns[$i]}"
    # echo -e -n "res VS ltlf in $directory:\t\t\t\t"
    # echo -e "$(count_files "$directory" "*.res")/$(count_files "$directory" "*.ltlf")"
    res_count=$(count_files "$directory" "*.res")
    ltlf_count=$(count_files "$directory" "*.ltlf")
    # printf "res VS ltlf in %s:\n\t\t %3d/%3d\n" "${directories[$i]}" "$res_count" "$ltlf_count"
    printf "%40s:\t%5d/%-5d\n" "${directories[$i]}" "$res_count" "$ltlf_count"
done
